pub struct Solution;


impl Solution {
    pub fn hammingWeight (n: u32) -> i32 {
        let mut count = 0;
        let mut tmp = n;
        while tmp != 0 {
            if tmp & 1 == 1 {
                count += 1;
            }
            tmp = tmp >> 1;
        }
        count
    }
}